Recently in banks, public offices, broker houses, etc., a huge amount of data is accumulated in a database for use in daily work. The database used in the work is generally used in a sequentially accessing method (SAM). The SAM is a method in which data is stored in a storage area in order sequentially from the leading position toward the trailing position, and the storage area of new data is located after the area in which the current data is stored. The operation performed on the database is adding, amending, copying, and deleting data. When data is deleted, the storage area in which the deleted data had been stored becomes a space area. However, in a database in the SAM, new data is added to the end of the storage area of all stored data. Therefore, the space area generated by deleting data remains unused. If the unused status is left as is, the storage area of the database is occupied by a number of space areas, and only a small amount of data is stored to fill the database. Therefore, when there is a space area, data is rearranged to fill space areas.
the rearrangement of a database in the SAM is performed by delimiting logical data, that is, in subranges. A subrange is, for example, a group of data of all clients processed by one branch office when the data of clients is managed by each branch office for the database of a bank. A user of a database can arbitrarily set a subrange, but a subrange is generally a group of logical pages storing a plurality of logical records (smallest unit of data). A logical record is, for example, passbook data for each client in a database of a bank. A subrange is a unit of sequential data access, and data is stored in order from the leading position to the trailing position in the subrange, but each subrange is independent of one another.
FIG. 1 illustrates the concept of the prior art.
Since it is necessary to rearrange the entire records in a subrange in order from the leading position, the entire logical records in the subrange are temporarily extracted and then stored again. In this case, since the entire subrange to be rearranged is exclusively controlled, the subrange cannot be used online during the rearrangement. The entire subrange is exclusively controlled because the rearrangement is realized by temporarily extracting the logical records in the entire subrange and storing the records again.
The access to a database can be an online process of operating data of the database, and a rearranging process of the data in the database, but it is necessary to perform exclusive control of the database to perform respective processes. Since the conventional rearranging process has been exclusively controlled in unit of a subrange, the subrange cannot be accessed online during the rearrangement. In a database of a bank, when a subrange is a unit of a branch office, all data cannot be accessed during the rearrangement if the rearranging process is performed. Therefore, it has been necessary to perform the rearranging process on Saturdays or Sundays when the branch office is closed.
FIGS. 2A and 2B are explanatory views of the conventional rearranging process.
In FIG. 2A, it is assumed that the database stores logical records on logical pages 0 through 3, and there are deletion areas (space areas) on the logical pages 0 through 2. In this example, it is assumed that the subrange is configured by the logical pages 0 through 3. In the database, the current store point (CSP) of the logical record is registered. In this case, the CSP is 3. A new record is stored in the logical page indicated by the CSP and the subsequent pages.
In FIG. 2B, the logical records in the entire subrange are copied to another storage area, all logical records on the logical pages 0 through 3 are deleted, and then the logical records in the entire subrange are stored again. Since there are four logical records in the case illustrated in FIG. 2B, and one logical page can store two logical records, all logical records are stored in the logical pages 0 and 1 if the logical records are stored again in order from the leading position. Then, the CSP is reset to 1.
Other prior arts can be a database re-organization device using a cluster as a logical group of records to be processed, a database re-organizing system having a disk drive for managing files on logically divided pages and moving the contents of a source page being used at the rear portion of a moved data unit to the destination page as a deleted page or an unused page.